#include "qlistline.h"


QListLine::QListLine(QErrorLine* error)
	: QListWidgetItem(),m_error(error)
{
	if(m_error)
	{
		QStringList title = m_error->designators();
		if(title.size()<3)
			setText(title.join(", ").remove("\""));
		else
		{
			QString t = title.first() + ", "+title[1]+", ...";
			setText(t.remove("\""));
		}
		
		if(m_error->importance() > IHM_FATAL_ERROR)
			m_icon = IHM_ICON_FATAL_ERROR;
	
		else if(m_error->importance() > IHM_IMPORTANT_ERROR)
			m_icon = IHM_ICON_IMPORTANT_ERROR;	
			
		else if(m_error->importance() > IHM_MINOR_ERROR)
			m_icon = IHM_ICON_MINOR_ERROR;
			
		else if(m_error->importance() > IHM_WARNING_ERROR)
			m_icon = IHM_ICON_WARNING_ERROR;	
			
		else if(m_error->importance() > IHM_WARNING_ERROR)
			m_icon = IHM_ICON_WARNING_ERROR;
	}
}

QListLine::~QListLine()
{
}

QString QListLine::id() const
{
	if(m_error)
		return m_error->id();
	return QString();
}

QString QListLine::iconPath() const
{
	return m_icon;
}

QList<quint32> QListLine::fileLines() const
{
	return m_error->lines();
}